INDEX.UPDATE Function

Syntax

V Update()

Description

The .UPDATE() method updates all of the index tags in an index file.

Discussion

You must reference one of the index tags in the index file. Use the .UPDATE() method when you think your indexes might have become corrupt. An alternative way to update the production indexes for a table is to use the <TBL>.UPDATE_PRODUCTION_INDEX() method.

Example

This script opens the Customer_temp.cdx index file and attaches it to the current table. The index file is updated to be sure any records that may have been added or changed while the index file was not open are included in the index.

dim tbl as P
dim idx as P
tbl = table.current()
idx = tbl.index_open(A_DB_CURRENT_PATH + "customer_temp.cdx")
'Index update requires exclusive access to the table.
'If you do not have exclusive access, an error is generated.
on error goto error_handler
idx.update()
end
error_handler:
    ui_msg_box("Error","Index was not updated. Cannot
    get exclusive access to table", UI_STOP_SYMBOL)
resume next

See Also